
---@class GT.projectile 投射物
---@field projectile Projectile 投射物
GT.projectile = class()

---@class projectile_data
---@field projectile Projectile 投射物

function GT.projectile:ctor(data)
    self.projectile=data.projectile
end





--- 在单位的挂接点创建一个投掷物
---@param p_key ProjectileKey 投掷物编号
---@param socket_unit Unit 挂节点所属单位
---@param socket_name Str 挂接点名称
---@param face Fixed 朝向
---@param owner_unit_or_player Actor 所属单位或玩家
---@param related_ability Ability 关联技能
---@param visibility Int32 粒子特效可见性规则
---@param duration Fixed 持续时间
---@param is_open_duration Bool 是否启用持续时间
---@return GT.projectile
function GT.projectile.create_projectile_on_socket(p_key,socket_unit,socket_name,face,owner_unit_or_player,related_ability,visibility,duration,is_open_duration)
    ---@type projectile_data
    local data={
        projectile=game_api.create_projectile_on_socket(p_key,socket_unit,socket_name,face,owner_unit_or_player,related_ability,visibility,duration,is_open_duration)
    }
    return new(GT.projectile, data)
end

--- 创建一个投掷物
---@param p_key ProjectileKey 投掷物编号
---@param location FVector3 位置
---@param face Fixed 朝向
---@param owner_unit_or_player Unit 所属单位
---@param related_ability Ability 关联技能
---@param duration Fixed 持续时间
---@param is_open_duration Bool 是否启用持续时间
---@param height Fixed 高度
---@param visibility Int32 粒子特效可见性规则
---@return GT.projectile
function create_projectile_in_scene(p_key,location,face,owner_unit_or_player,related_ability,duration,is_open_duration,height,visibility)
    ---@type projectile_data
    local data={
        projectile=game_api.create_projectile_in_scene(p_key,location,face,owner_unit_or_player,related_ability,duration,is_open_duration,height,visibility)
    }
    return new(GT.projectile, data)
end

--- 创建一个投掷物
---@param p_key ProjectileKey 投掷物编号
---@param location FVector3 位置
---@param owner_unit_or_player Actor 所属单位或玩家
---@param face Fixed 朝向
---@param related_ability Ability 关联技能
---@param duration Fixed 持续时间
---@param is_open_duration Bool 是否启用持续时间
---@param height Fixed 高度
---@param visibility Int32 粒子特效可见性规则
---@return GT.projectile
function create_projectile_in_scene_new(p_key,location,owner_unit_or_player,face,related_ability,duration,is_open_duration,height,visibility)
    ---@type projectile_data
    local data={
        projectile=game_api.create_projectile_in_scene_new(p_key,location,owner_unit_or_player,face,related_ability,duration,is_open_duration,height,visibility)
    }
    return new(GT.projectile, data)
end


--- 投射物本身对象
---@return Unit
function GT.projectile:api_get_self()
    GT.projectile.api_get_self()
end

--- 投射物编号
---@return ProjectileKey
function GT.projectile:get_key()
    GT.projectile.api_get_key()
end

--- 投射物产生者
---@return Unit
function GT.projectile:api_get_owner()
    GT.projectile.api_get_owner()
end

--- 销毁投射物对象
---@param unit Unit 销毁的投射物对象
---@param immediately Bool 立即移除表现
function GT.projectile:api_delete(unit,immediately)
    GT.projectile.api_delete(unit,immediately)
end

--- 设置投射物位置
---@param point Point 投射物位置
function GT.projectile:api_set_position(point)
    GT.projectile.api_set_position(point)
end

--- 设置投射物朝向
---@param face_angle Float 投射物朝向
function GT.projectile:api_set_face_angle(face_angle)
    GT.projectile.api_set_face_angle(face_angle)
end

--- 设置投射物旋转
---@param x Float x轴旋转
---@param y Float y轴旋转
---@param z Float z轴旋转
function GT.projectile:api_set_rotation(x,y,z)
    GT.projectile.api_set_rotation(x,y,z)
end

--- 设置投射物缩放
---@param x Float x轴缩放
---@param y Float y轴缩放
---@param z Float z轴缩放
function GT.projectile:api_set_scale(x,y,z)
    GT.projectile.api_set_scale(x,y,z)
end

--- 设置投射物特效播放速度
---@param rate Float 播放速度
function GT.projectile:api_set_animation_speed(rate)
    GT.projectile.api_set_animation_speed(rate)
end

--- 设置投射物持续时间
---@param duration Float 持续时间
function GT.projectile:api_set_duration(duration)
    GT.projectile.api_set_duration(duration)
end

--- 增加投射物持续时间
---@param extra_time Float 持续时间变化值
function GT.projectile:api_add_duration(extra_time)
    GT.projectile.api_add_duration(extra_time)
end

--- 获取投射物剩余持续时间
---@return Float
function GT.projectile:api_get_left_time()
    GT.projectile.api_get_left_time()
end

--- 获取投射物高度
---@return Float
function GT.projectile:api_get_height()
    GT.projectile.api_get_height()
end

--- 获取投射物角度
---@return Float
function GT.projectile:api_get_face_angle()
    GT.projectile.api_get_face_angle()
end

--- 获取投射物位置
---@return FVector3
function GT.projectile:api_get_position()
    GT.projectile.api_get_position()
end

--- 获取投射物朝向
---@return FVector3
function GT.projectile:api_get_face_dir()
    GT.projectile.api_get_face_dir()
end

--- 投射物抬高
---@param y Fixed 定点数
function GT.projectile:api_raise_height(y)
    GT.projectile.api_raise_height(Fix32(y))
end

--- 获取投射物的字符串属性
---@param attr_name Str 属性名称
---@return Str
function GT.projectile:api_get_str_attr(attr_name)
    GT.projectile.api_get_str_attr(attr_name)
end

--- 设置投射物的字符串属性
---@param attr_name Str 属性名称
---@param value Str 属性取值
function GT.projectile:api_set_str_attr(attr_name,value)
    GT.projectile.api_set_str_attr(attr_name,value)
end

--- 投射物添加键值对
---@param tag Str TAG
function GT.projectile:api_add_tag(tag)
    GT.projectile.api_add_tag(tag)
end

--- 投射物移除键值对
---@param tag Str TAG
function GT.projectile:api_remove_tag(tag)
    GT.projectile.api_remove_tag(tag)
end

--- 对投射物所属单位的所属玩家关系播放音乐
---@param camp_target RoleRelation 玩家关系
---@param sid AudioKey 乐曲编号
---@param loop Bool 是否循环
function GT.projectile:api_play_sound_by_proj_for_role_relation(camp_target,sid,loop)
    GT.projectile.api_play_sound_by_proj_for_role_relation(camp_target,sid,loop)
end


--- 返回指定投射物类型的名称
---@return Str
function GT.projectile:get_projectile_name_by_type()
    return game_api.get_projectile_name_by_type(self:get_key())
end

--- 返回指定投射物类型的描述
---@return Str
function GT.projectile:get_projectile_desc_by_type()
    return game_api.get_projectile_desc_by_type(self:get_key())
end

--- 投射物实体是否存在
---@param projectile GT.projectile 投射物
---@return Bool
function GT.projectile.projectile_is_exist(projectile)
    return game_api.projectile_is_exist(projectile.projectile)
end

--- 最近创建投射物
---@return GT.unit
function GT.projectile.get_last_created_projectile()
    ---@type unit_data
    local data={
        unit=game_api.get_last_created_projectile()
    }
    return new(GT.unit, data)
end


--- 改变投射物所属单位
---@param projectile ProjectileEntity 投射物
---@param unit Unit 单位
function change_projectile_owner(projectile,unit)end

--- 改变投射物所属技能
---@param projectile ProjectileEntity 投射物
---@param related_ability Ability 单位
function change_projectile_ability(projectile,related_ability)end